package com.kelvin.paopao.module.market.wallet.charge;

import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.widget.EditText;

import com.kelvin.paopao.R;
import com.kelvin.paopao.injector.components.DaggerChargeComponent;
import com.kelvin.paopao.injector.modules.ChargeModule;
import com.kelvin.paopao.module.base.BaseActivity;
import com.kelvin.paopao.widgets.CustomToolbar;
import com.kelvin.paopao.widgets.SelectPayWayView;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by MCK on 2017/5/11.
 */

public class ChargeActivity extends BaseActivity<IWalletChargePresenter> implements IWalletChargeView {
    @BindView(R.id.custom_toolbar)
    CustomToolbar customToolbar;
    @BindView(R.id.et_money)
    EditText etMoney;
    @BindView(R.id.select_pay_way)
    SelectPayWayView selectPayWay;

    @Override
    protected int attachLayoutRes() {
        return R.layout.activity_charge;
    }

    @Override
    protected void initInjector() {
        DaggerChargeComponent.builder().chargeModule(new ChargeModule(this))
                .build().inject(this);
    }

    @Override
    protected void initViews() {
        customToolbar.showBackIcon(this);
    }

    @Override
    protected void updateViews(boolean isRefresh) {

    }

    @OnClick(R.id.tv_confirm)
    public void onClick() {
        String money = etMoney.getText().toString().trim();
        if (!TextUtils.isEmpty(money)) {
            mPresenter.chargeMoney(money);
        }
    }

    @Override
    public void loadData() {

    }

    /**
     * 进入充值页面
     */
    public static void launch(Context context) {
        Intent intent = new Intent(context, ChargeActivity.class);
        context.startActivity(intent);
    }
}
